From: Jasper St. Pierre Date: Wed, 12 Jun 2013 21:38:02 +0000 (-0400) Subject: popupMenu: Don't close submenus when the toplevel container is closed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3944 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2aae272d865d7526e87611a43d7a169918cb1e64;p=gnome-shell.git popupMenu: Don't close submenus when the toplevel container is closed It seems this behavior at one time was intentional, but I (along with the designers) think it looks ugly having the menu having its insides shrinking and shifting around while fading out of existence. There's two cases where we currently explicitly try to animate the submenu closed -- when an item is clicked inside the submenu, and when the toplevel closes. This removes both of those. The user expectation is that submenus will be closed the next time the toplevel is open even if they were open before, so force submenus closed when the toplevel finishes fading out, without any animation. https://bugzilla.gnome.org/show_bug.cgi?id=702539 --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index b5b156db6..3b9347b3c 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -772,7 +772,6 @@ const PopupMenuBase = new Lang.Class({ _connectSubMenuSignals: function(object, menu) { object._subMenuActivateId = menu.connect('activate', Lang.bind(this, function() { this.emit('activate'); - this.close(BoxPointer.PopupAnimation.FULL); })); object._subMenuActiveChangeId = menu.connect('active-changed', Lang.bind(this, function(submenu, submenuItem) { if (this._activeMenuItem && this._activeMenuItem != submenuItem) @@ -887,10 +886,14 @@ const PopupMenuBase = new Lang.Class({ else menuItem.close(); }); + menuItem._parentClosingId = this.connect('menu-closed', function() { + menuItem.emit('menu-closed'); + }); menuItem.connect('destroy', Lang.bind(this, function() { menuItem.disconnect(menuItem._subMenuActivateId); menuItem.disconnect(menuItem._subMenuActiveChangeId); this.disconnect(menuItem._parentOpenStateChangedId); + this.disconnect(menuItem._parentClosingId); this.length--; })); @@ -901,9 +904,8 @@ const PopupMenuBase = new Lang.Class({ this.box.insert_child_below(menuItem.menu.actor, before_item); this._connectSubMenuSignals(menuItem, menuItem.menu); this._connectItemSignals(menuItem); - menuItem._closingId = this.connect('open-state-changed', function(self, open) { - if (!open) - menuItem.menu.close(BoxPointer.PopupAnimation.FADE); + menuItem._closingId = this.connect('menu-closed', function() { + menuItem.menu.close(BoxPointer.PopupAnimation.NONE); }); } else if (menuItem instanceof PopupSeparatorMenuItem) { this._connectItemSignals(menuItem); @@ -1114,8 +1116,11 @@ const PopupMenu = new Lang.Class({ childMenu.close(); }); - if (this._boxPointer.actor.visible) - this._boxPointer.hide(animate); + if (this._boxPointer.actor.visible) { + this._boxPointer.hide(animate, Lang.bind(this, function() { + this.emit('menu-closed'); + })); + } if (!this.isOpen) return;